package com.qijian.maindata.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qijian.common.annotation.Excel;
import com.qijian.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 质量绩效对象 main_quality_performance
 *
 * @author qijian
 * @date 2022-09-30
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString
@TableName("main_quality_performance")
public class QualityPerformance extends BaseEntity{
    private static final long serialVersionUID = 1L;

    @TableId
    @JsonSerialize(using= ToStringSerializer.class)
    @ApiModelProperty(value = "ID")
    private Long workId;

    @JsonSerialize(using= ToStringSerializer.class)
    @ApiModelProperty(value = "关联bom")
    private Long bomId;

    @JsonSerialize(using= ToStringSerializer.class)
    @ApiModelProperty(value = "用户ID")
    private Long manageUserId;

    @Excel(name = "用户姓名", sort = 8)
    @ApiModelProperty(value = "用户姓名")
    private String manageNickName;

    @JsonSerialize(using= ToStringSerializer.class)
    @ApiModelProperty(value = "部门id")
    private Long manageDeptId;

    @Excel(name = "部门名称", sort = 9)
    @ApiModelProperty(value = "部门名称")
    private String manageDeptName;

    @Excel(name = "工单编号", sort = 1)
    @ApiModelProperty(value = "工单编号")
    private String workCode;

    @JsonSerialize(using= ToStringSerializer.class)
    @ApiModelProperty(value = "物料ID")
    private Long itemId;

    @ApiModelProperty(value = "物料名称")
    private String itemName;

    @Excel(name = "工序名称", sort = 5)
    @ApiModelProperty(value = "工序名称")
    private String processName;

    @Excel(name = "数量")
    @ApiModelProperty(value = "数量")
    private Long workNumber;

    @Excel(name = "工序工时", sort = 6)
    @ApiModelProperty(value = "工序工时")
    private BigDecimal workTime;

    @Excel(name = "工序工价", sort = 7)
    @ApiModelProperty(value = "工序工价")
    private BigDecimal workCost;

    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "开始时间")
    private Date workStartTime;

    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "结束时间")
    private Date workEndTime;

    @Excel(name = "状态", readConverterExp = "0=完成，1=待派发，2=接单，4=报工", sort = 11)
    @ApiModelProperty(value = "状态（0=完成，1=待派发，2=接单，4=报工）")
    private Integer status;

    @Excel(name = "备注")
    @ApiModelProperty(value = "备注")
    private String remark;

    @JsonSerialize(using= ToStringSerializer.class)
    @ApiModelProperty(value = "作业人员id")
    private Long userId;

    @Excel(name = "作业人", sort = 10)
    @ApiModelProperty(value = "作业人员名称")
    private String nickName;

    @Excel(name = "作业工时")
    @ApiModelProperty(value = "作业工时")
    private BigDecimal times;

    @Excel(name = "作业工价")
    @ApiModelProperty(value = "作业工价")
    private BigDecimal prices;

    @JsonSerialize(using= ToStringSerializer.class)
    @ApiModelProperty(value = "作业人部门id")
    private Long deptId;

    @Excel(name = "作业人部门")
    @ApiModelProperty(value = "作业人部门")
    private String deptName;

    @Excel(name = "开工令号", sort = 2)
    @ApiModelProperty(value = "开工令号")
    private String projectNo;

    @Excel(name = "产品名称", sort = 3)
    @ApiModelProperty(value = "产品名称")
    private String productName;

    @Excel(name = "类型", sort = 5)
    @ApiModelProperty(value = "派工类型")
    private String workType;

    @TableField(exist = false)
    private List<QualityPerformance> users;

    //1 非工装部工单，2 工装部工单,默认1
    private Integer orderType;

    private Long projectId;

    @Excel(name = "派工时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "派工时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date dispatchTime;

    @Excel(name = "小计")
    @ApiModelProperty(value = "小计")
    private BigDecimal totalPrice;

}
